package com.hk.commons.enm;

/**
 * Created by Antinomy on 17/5/12.
 */
public enum MsgType {

    UNKNOWN("-1", "未知类型"),      // 注册
    REGISTER("1", "注册通知"),      // 注册
    BIND_CARD("2", "绑卡通知"),     // 绑卡
    APPOINTMENT("3", "预约通知"),
    BUY("4", "购买通知"),
    PAYBACK("5", "回款通知"),
    WITHDRAW("6", "提现通知"),
    RECHARGE("7", "充值通知"),
    ANNOUNCEMENT("8", "公告通知"),
    ACTIVITY("9", "活动通知"),;

    protected String type;
    protected String code;

    MsgType(String code, String type) {
        this.type = type;
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static MsgType findByCode(String code) {

        for (MsgType msg : MsgType.values()) {
            if (msg.getCode().equals(code))
                return msg;
        }

        return MsgType.UNKNOWN;
    }
}
